<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Guess content type</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="httpresponse.getthrottledelay.html">HttpResponse::getThrottleDelay</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="httpresponse.redirect.html">HttpResponse::redirect</a></div>
 <div class="up"><a href="class.httpresponse.html">HttpResponse</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="httpresponse.guesscontenttype" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">HttpResponse::guessContentType</h1>
  <p class="verinfo">(PECL pecl_http &gt;= 0.13.0)</p><p class="refpurpose"><span class="refname">HttpResponse::guessContentType</span> &mdash; <span class="dc-title">Guess content type</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-httpresponse.guesscontenttype-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">static</span>
   <span class="type">string</span> <span class="methodname"><strong>HttpResponse::guessContentType</strong></span>
    ( <span class="methodparam"><span class="type">string</span> <code class="parameter">$magic_file</code></span>
   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$magic_mode</code><span class="initializer"> = MAGIC_MIME</span></span>
  ] )</div>

  <p class="para rdfs-comment">
   Attempts to guess the content type of supplied payload through libmagic.
  </p>
  <p class="para">
   If the attempt is successful, the guessed <em>Content-Type</em> will automatically
   be set as response <em>Content-Type</em>.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-httpresponse.guesscontenttype-parameters">
  <h3 class="title">参数</h3>
  <p class="para">
   <dl>

    
     <dt>
<em><code class="parameter">magic_file</code></em></dt>

     <dd>

      <p class="para">
       specifies the magic.mime database to use
      </p>
     </dd>

    
    
     <dt>
<em><code class="parameter">magic_mode</code></em></dt>

     <dd>

      <p class="para">
       flags for libmagic
      </p>
     </dd>

    
   </dl>

  </p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-httpresponse.guesscontenttype-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns the guessed content type on success 或者在失败时返回 <strong><code>FALSE</code></strong>.
  </p>
 </div>


 <div class="refsect1 errors" id="refsect1-httpresponse.guesscontenttype-errors">
  <h3 class="title">错误／异常</h3>
  <p class="para">
   Throws <strong class="classname">HttpRuntimeException</strong>, <strong class="classname">HttpInvalidParamException</strong>.
  </p>
 </div>



 


 


 <div class="refsect1 seealso" id="refsect1-httpresponse.guesscontenttype-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="methodname"><a href="httpresponse.getcontenttype.html" class="methodname" rel="rdfs-seeAlso">HttpResponse::getContentType()</a> - Get content type</span></li>
    <li class="member"><span class="methodname"><a href="httpresponse.setcontenttype.html" class="methodname" rel="rdfs-seeAlso">HttpResponse::setContentType()</a> - Set content type</span></li>
   </ul>
  </p>
 </div>



</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="httpresponse.getthrottledelay.html">HttpResponse::getThrottleDelay</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="httpresponse.redirect.html">HttpResponse::redirect</a></div>
 <div class="up"><a href="class.httpresponse.html">HttpResponse</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
